﻿#pragma once

#include "SysBase.h"
#include "math/bMath.h"
#include "geo/IndexedTriangleList.h"

namespace Base {

	struct MeshData
	{
		// TODO: load from file

		// data
		std::vector<Vec3> m_posVec;
		std::vector<Vec3> m_normalVec;
		std::vector<Vec4> m_colorVec;
		std::vector<Vec2> m_texVec;
		std::vector<Vec3> m_tangentVec;
		std::vector<unsigned short> m_indicesVec;

		// func
		void InitFromIndexedTriangleList(const IndexedTriangleList& t);
		void InitFromIndexedTriangleList(const IndexedTriangleList& t, const Vec4& color);
	};


	// 单个MeshData需要设置到输入装配阶段的内容
	// 输入布局、strides、offsets和图元由Effect Pass提供
	// 其余数据源自MeshData
	struct MeshDataInput
	{
		ID3D11InputLayout* pInputLayout = nullptr;
		D3D11_PRIMITIVE_TOPOLOGY topology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
		std::vector<ID3D11Buffer*> pVertexBuffers;
		ID3D11Buffer* pIndexBuffer = nullptr;
		std::vector<UINT> strides;
		std::vector<UINT> offsets;
		UINT indexCount = 0;
	};

}
